package com.xja.cloud.service;

import com.xja.cloud.entity.Product;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

@Service("productService")
public class ProductServiceImpl implements ProductService {

    Map<Integer, Product> prodMap = new HashMap<>();

    public ProductServiceImpl() {
        Product product1 = new Product(1,"方便面","华龙方便面厂");
        Product product2 = new Product(2,"火腿肠","春都火腿肠厂");
        prodMap.put(1,product1);
        prodMap.put(2,product2);

    }

    @Override
    public Product findById(Integer pid) {
        return  prodMap.get(pid);
    }
}
